#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include<QMessageBox>
#include<QPainter>
#include<QJsonArray>

//该类用于网络请求，获取响应，处理错误等信息
#include<QNetworkAccessManager>
//QNetworkReply是QNetworkAccessManager发送请求后的返回类
#include<QNetworkReply>
//多媒体播放器类
#include<QMediaPlayer>
//多媒体播放器列表
#include<QMediaPlaylist>

#include<QTextBlock>
#include<QTimer>
#include<QFileDialog>

//解析json数据时错误处理
#include<QJsonParseError>
#include<QJsonObject>

#include<QMovie>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    //窗口移动
    void mousePressEvent(QMouseEvent* event);
    void mouseMoveEvent(QMouseEvent* event);
    void mouseReleaseEvent(QMouseEvent* event);

    bool m_MouseDrag;

    QPoint m_distance;         //鼠标移动的距离
    QPoint mouseStartPoint;     //鼠标起始位置
    QPoint windowStartPoint;  //窗口起始位置

    QMediaPlayer *playerObject;
    QMediaPlaylist *playerlist;

    QString StrlocalMusicPath;

    //歌曲id
    int musicId;
    //歌曲名,歌手名
    QString strMusicName;
    QString strSingerName;
    int iPos;
    int totalTime;

    QByteArray byteSearchInfo;    //存贮搜索信息
    QTextDocument *docTextObj;     //处理富文本内容
    QTextBlock *TextBlock;          //处理文本块
    QMovie *movie1;
    bool isDrag;
    QNetworkAccessManager *networkAccessManager;


public slots:
    void handleDateBackFunc(QNetworkReply *reply);     //信息返回

    void timeChangeFunc(qint64 currentTime);    //处理label时间变化

    void handleProgressChangeFunc(qint64 currentTime);   //进度条变化

    void handlePositionChangeFunc(qint64 currentTime);   //拖动进度条变化



private slots:
    void on_pushButton_minShow_clicked();

    void on_pushButton_exit_clicked();

    void on_pushButton_file_clicked();

    void on_pushButton_font_clicked();

    void on_pushButton_start_stop_clicked();

    void on_pushButton_next_clicked();

    void on_pushButton_restart_clicked();

    void on_pushButton_reserch_clicked();

    void on_pushButton_voice_clicked();

    void on_horizontalSlider_voice_valueChanged(int value);


    void on_horizontalSlider_progress_valueChanged(int value);

private:
    Ui::MainWindow *ui;

    void paintEvent(QPaintEvent *event);
    void startGifFunc();
};
#endif // MAINWINDOW_H
